<template>
  <div>
    <section class="mainWrap">
      <MainCompList v-if="detailAdcode" :detailFlag="false" :detailAdcode="detailAdcode"></MainCompList>
    </section>
  </div>
</template>

<script setup>
import MainCompList from "@/components/MainCompList.vue";
import {ref, watch} from 'vue'
import {useRoute} from "vue-router";

const route = useRoute()
const detailAdcode = ref('')

// 监听路由参数变化
watch(() => route.params.adcode, (newVal) => {
  console.log('路由参数变化:', newVal)
  detailAdcode.value = newVal
}, { immediate: true }) // 添加 immediate: true 确保首次加载时也会触发

// 初始化值
detailAdcode.value = route.params.adcode
</script>

<style scoped>

</style>